package edu.upenn.yas;

import java.util.Date;
import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class AddASDF extends ActionSupport {
    private String url;
    private String title;
    private String content;
    private String result;

    public String execute() {
        Map session = ActionContext.getContext().getSession();
        System.out.println(title);
        System.err.println(title);
        if (true) {
            String username = (String)session.get("username");
            boolean success = 
                QueryEngine.instance.addASDF(url, title, content, username);
            if (success) {
                result = "Submission accepted!";
                return SUCCESS;
            } else {
                result = "Submission not worthy, rejected.";
                return ERROR;
            }
        }
        result = "Not logged in.";
        return ERROR;
    }

    public String getUrl() { return url; }
    public void setUrl(String url) { this.url= url; }
    public String getTitle() { return title; }
    public void setTitle(String title) { this.title= title; }
    public String getContent() { return content; }
    public void setContent(String content) { this.content= content; }
    public String getResult() { return result; }
    public void setResult(String result) { this.result = result; }
}

